package user;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

import main.Service;

@Entity(name="usercheck")
public class UserCheck {
	@Id
	@Column(name="USERNAME", length=50)
	private String username;
	@Column(name="PASSWORD", length=50, nullable=false)
	private String password;
	@ManyToOne
	@JoinColumn(name="USERID")
	private User user;
	@OneToOne(mappedBy="usercheck")
	private Service service;
	
	public UserCheck(String username, String password){
		this.username = username;
		this.password = password;
	}
	
	public UserCheck(){
		
	}
	
	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}
	void setPassword(String password) {
		this.password = password;
	}
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Service getService() {
		return service;
	}

	public void setService(Service service) {
		this.service = service;
	}

	@Override
	public boolean equals(Object obj) {
		if(((UserCheck)obj).getUsername() == this.username){
			return true;
		}else{
			return false;
		}
	}
}
